import {defineStore} from "pinia";
import '@/mock/training/index'
import {type trainingContentList, getTraining} from "@/api/trainingRoom";

interface initContentListModel {
    contentList: trainingContentList
}

const initContentLData = (): initContentListModel => ({
    contentList: []
})
export const useTrainingStore = defineStore('training', {
    state: () => (initContentLData()),
    actions: {
        async getTrainingList() {
            try {
                const res = await getTraining()
                console.log(44, res)
                this.contentList = res.data.content
                console.log(88, this.contentList)
            } catch (error) {
                return Promise.reject(error)
            }
        }
    }
})
